﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using NextAction.Domain.Abstract;
using System.Web.Mvc;

namespace NextAction.Domain.Entities
{
    public enum GtdTaskType
    {
        Inbox = 0,
        Next = 1,
        Wait = 2,
        Someday = 3
    }

    public class GtdTask : GtdEntity
    {
        [Key]
        [HiddenInput(DisplayValue = false)]
        public int TaskID { get; set; }

        public int ProjectID { get; set; }

        public int TaskTypeID { get; set; }

        public GtdTaskType TaskType
        { 
            get { return (GtdTaskType) TaskTypeID; }
            set { TaskTypeID = (int) value;  } 
        } 

        [NotMapped]
        public string ProjectName { get; set; }

        public DateTime ?ScheduleDate { get; set; }

        public override void CopyFrom(GtdEntity entity)
        {
            base.CopyFrom(entity);
            if (entity is GtdTask)
            {
                GtdTask task = (GtdTask)entity; 
                this.TaskID = task.TaskID;
                this.ProjectID = task.ProjectID;
                this.TaskTypeID = task.TaskTypeID;
                this.ScheduleDate = task.ScheduleDate;
            }
        }

    }
}
